CMAKE_MINIMUM_REQUIRED(VERSION 3.3.0) # deb package fix in 3.3.0
###################### Branding ##########################

SET(BRANDING_PROJECT_NAME "FastoTV" CACHE STRING "Branding for ${BRANDING_PROJECT_NAME}") #default
SET(BRANDING_PROJECT_VERSION "1.25.0.60" CACHE STRING "Branding version for ${BRANDING_PROJECT_NAME}") #default
SET(BRANDING_PROJECT_BUILD_TYPE_VERSION "release" CACHE STRING "Build version type for ${BRANDING_PROJECT_NAME}") #default
  #possible variables: alfa, beta, rc, release

SET(BRANDING_PROJECT_DOMAIN "https://fastotv.com" CACHE STRING "Branding domain url for ${BRANDING_PROJECT_NAME}") #default
SET(BRANDING_PROJECT_DOWNLOAD_LINK "https://fastotv.com/downloads" CACHE STRING "Branding download root url for ${BRANDING_PROJECT_NAME}")
SET(BRANDING_PROJECT_COMPANYNAME "FastoGT" CACHE STRING "Company name for ${BRANDING_PROJECT_NAME}") #default
SET(BRANDING_PROJECT_COMPANYNAME_DOMAIN "https://fastogt.com" CACHE STRING "Internet domain name company for ${BRANDING_PROJECT_NAME}") #default
SET(BRANDING_PROJECT_MAINTAINER_MAIL "atopilski@fastogt.com" CACHE STRING "Internet mail address maintainer of ${BRANDING_PROJECT_NAME}") #default
SET(BRANDING_PROJECT_MAINTAINER_NAME "Alexandr Topilski" CACHE STRING "Name of maintainer for ${BRANDING_PROJECT_NAME}") #default

SET(BRANDING_PROJECT_GITHUB_FORK "https://github.com/fastogt/fastotv" CACHE STRING "Branding fork url for ${BRANDING_PROJECT_NAME}") #default
SET(BRANDING_PROJECT_GITHUB_ISSUES "https://github.com/fastogt/fastotv/issues" CACHE STRING "Branding issues url for ${BRANDING_PROJECT_NAME}") #default

SET(BRANDING_PROJECT_HOMEPAGE_LINK "https://fastotv.com" CACHE STRING "Home page link for ${BRANDING_PROJECT_NAME}") #default
SET(BRANDING_PROJECT_FACEBOOK_LINK "https://facebook.com/profile.php?id=100016809641223" CACHE STRING "FaceBook link for ${BRANDING_PROJECT_NAME}") #default
SET(BRANDING_PROJECT_TWITTER_LINK "https://twitter.com/FastoTv" CACHE STRING "Twitter link for ${BRANDING_PROJECT_NAME}") #default
SET(BRANDING_PROJECT_GITHUB_LINK "https://github.com/fastogt/fastotv" CACHE STRING "GitHub link for ${BRANDING_PROJECT_NAME}") #default

SET(BRANDING_PROJECT_SUMMARY "Cross-platform open source TV player." CACHE STRING "Short description of ${BRANDING_PROJECT_NAME}")
SET(BRANDING_PROJECT_DESCRIPTION "${BRANDING_PROJECT_NAME} it is TV player." CACHE STRING "Description of ${BRANDING_PROJECT_NAME}")
SET(BRANDING_PROJECT_COPYRIGHT "Copyright (C) 2014-2020 ${BRANDING_PROJECT_COMPANYNAME} All Rights Reserved." CACHE STRING "Copyright notice for ${BRANDING_PROJECT_NAME}") #default

PROJECT(${BRANDING_PROJECT_NAME} VERSION ${BRANDING_PROJECT_VERSION} LANGUAGES CXX C)
SET(CMAKE_CXX_STANDARD 14)
SET(CMAKE_CXX_STANDARD_REQUIRED ON)
SET(CMAKE_CXX_EXTENSIONS OFF)
SET(CMAKE_C_STANDARD 99)
SET(CMAKE_C_STANDARD_REQUIRED ON)
#SET(CMAKE_C_EXTENSIONS OFF)
#################### Project Settings ####################
SET(PROJECT_NAME_TITLE ${PROJECT_NAME}) #PROJECT_NAME in cache
SET(PROJECT_DOMAIN ${BRANDING_PROJECT_DOMAIN})
SET(PROJECT_DOWNLOAD_LINK ${BRANDING_PROJECT_DOWNLOAD_LINK})
SET(PROJECT_COMPANYNAME ${BRANDING_PROJECT_COMPANYNAME})
SET(PROJECT_COPYRIGHT ${BRANDING_PROJECT_COPYRIGHT})
SET(PROJECT_SUMMARY ${BRANDING_PROJECT_SUMMARY})
SET(PROJECT_DESCRIPTION ${BRANDING_PROJECT_DESCRIPTION})
SET(PROJECT_COMPANYNAME_DOMAIN ${BRANDING_PROJECT_COMPANYNAME_DOMAIN})
SET(PROJECT_MAINTAINER_MAIL ${BRANDING_PROJECT_MAINTAINER_MAIL})
SET(PROJECT_MAINTAINER_NAME ${BRANDING_PROJECT_MAINTAINER_NAME})
SET(PROJECT_GITHUB_FORK ${BRANDING_PROJECT_GITHUB_FORK})
SET(PROJECT_GITHUB_ISSUES ${BRANDING_PROJECT_GITHUB_ISSUES})

SET(PROJECT_BUILD_TYPE_VERSION ${BRANDING_PROJECT_BUILD_TYPE_VERSION})
SET(PROJECT_HOMEPAGE_LINK ${BRANDING_PROJECT_HOMEPAGE_LINK})
SET(PROJECT_FACEBOOK_LINK ${BRANDING_PROJECT_FACEBOOK_LINK})
SET(PROJECT_TWITTER_LINK ${BRANDING_PROJECT_TWITTER_LINK})
SET(PROJECT_GITHUB_LINK ${BRANDING_PROJECT_GITHUB_LINK})
##########################################################

STRING(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWERCASE)
STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UPPERRCASE)

SET(PROJECT_BRANDING_FOLDER ${CMAKE_SOURCE_DIR}/install/${PROJECT_NAME_LOWERCASE})
SET(PROJECT_VERSION_SHORT ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}) #PROJECT_VERSION_* in cache
SET(PROJECT_VERSION_INTEGER ${PROJECT_VERSION_MAJOR}${PROJECT_VERSION_MINOR}${PROJECT_VERSION_PATCH}) #PROJECT_VERSION_* in cache

MESSAGE(STATUS "PROJECT_VERSION: ${PROJECT_VERSION}")

SET(PROJECT_CHANGELOG_FILE ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/CHANGELOG)
SET(DATE_CMD "date")
SET(DATE_ARGS "+%a %b %d %Y")
EXECUTE_PROCESS(COMMAND ${DATE_CMD} ${DATE_ARGS} RESULT_VARIABLE CHANGELOG_TIMESTAMP_RESULT OUTPUT_VARIABLE CHANGELOG_TIMESTAMP)  #for rpm package
IF (NOT "${CHANGELOG_TIMESTAMP}" STREQUAL "")
  STRING(REPLACE "\n" "" CHANGELOG_TIMESTAMP ${CHANGELOG_TIMESTAMP})
ELSE()
  MESSAGE(WARNING "Failed to get timestamp: ${CHANGELOG_TIMESTAMP_RESULT}")
ENDIF(NOT "${CHANGELOG_TIMESTAMP}" STREQUAL "")
FILE(WRITE ${PROJECT_CHANGELOG_FILE} "* ${CHANGELOG_TIMESTAMP} ${PROJECT_MAINTAINER_NAME} <${PROJECT_MAINTAINER_MAIL}>\n")
FILE(READ ${PROJECT_BRANDING_FOLDER}/CHANGELOG CHANGELOG_TEXT)
FILE(APPEND ${PROJECT_CHANGELOG_FILE} ${CHANGELOG_TEXT})

IF(APPLE AND CMAKE_OSX_SYSROOT)
  STRING(REGEX REPLACE ".*MacOSX([0-9]+)\\.([0-9]+).*$" "\\1" DARWIN_MAJOR_SDK_VERSION "${CMAKE_OSX_SYSROOT}")
  STRING(REGEX REPLACE ".*MacOSX([0-9]+)\\.([0-9]+).*$" "\\2" DARWIN_MINOR_SDK_VERSION "${CMAKE_OSX_SYSROOT}")
  IF(EXISTS "${CMAKE_OSX_SYSROOT}")
    SET(MACOSX_DEPLOYMENT_TARGET ${DARWIN_MAJOR_SDK_VERSION}.${DARWIN_MINOR_SDK_VERSION})
    SET(CMAKE_CXX_FLAGS "--sysroot ${CMAKE_OSX_SYSROOT} ${CMAKE_CXX_FLAGS}")
    MESSAGE(STATUS "Setting MACOSX_DEPLOYMENT_TARGET to '${MACOSX_DEPLOYMENT_TARGET}'.")
  ENDIF()
ENDIF(APPLE AND CMAKE_OSX_SYSROOT)

########################## Options #########################
OPTION(CPACK_SUPPORT "Enable package support" ON)
OPTION(LOG_TO_FILE "Logging to file" OFF)
OPTION(DEVELOPER_ENABLE_TESTS "Enable tests for ${PROJECT_NAME_TITLE} project" OFF)
OPTION(DEVELOPER_CHECK_STYLE "Enable check style for ${PROJECT_NAME_TITLE} project" OFF)
OPTION(DEVELOPER_GENERATE_DOCS "Generate docs api for ${PROJECT_NAME_TITLE} project" OFF)
IF (DEVELOPER_ENABLE_TESTS)
  OPTION(DEVELOPER_ENABLE_UNIT_TESTS "Enable tests for ${PROJECT_NAME_TITLE} project" ON)
ENDIF(DEVELOPER_ENABLE_TESTS)
##################################DEFAULT VALUES##########################################
IF(NOT CMAKE_BUILD_TYPE)
  SET(CMAKE_BUILD_TYPE DEBUG)
ENDIF(NOT CMAKE_BUILD_TYPE)

# If the user did not customize the install prefix,
# set it to live under build so we don't inadvertently pollute /usr/local
IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
  SET(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "default install path" FORCE)
ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)

IF("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}")
  MESSAGE(SEND_ERROR "In-source builds are not allowed.")
ENDIF("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}")

MESSAGE(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}")

############################################################################

SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/cmake")
INCLUDE(config) ###################
DEFINE_DEFAULT_DEFINITIONS(OFF ON OFF)
DEFINE_PROJECT_DEFINITIONS()

##########################################################

# pwd + RELATIVE_SOURCE_DIR = install directory
IF(OS_WINDOWS)
  SET(LIB_INSTALL_DESTINATION .)
  SET(TARGET_INSTALL_DESTINATION .)
  SET(SHARE_INSTALL_DESTINATION share)
  SET(RELATIVE_SOURCE_DIR .)
  SET(EXECUTABLE_NAME ${PROJECT_NAME}.exe)
ELSEIF(OS_MACOSX)
  SET(BUNDLE_BASE_NAME ${PROJECT_NAME})
  SET(BUNDLE_NAME ${BUNDLE_BASE_NAME}.app)
  SET(LIB_INSTALL_DESTINATION .)
  SET(TARGET_INSTALL_DESTINATION .)
  SET(SHARE_INSTALL_DESTINATION ${BUNDLE_NAME}/Contents/share)
  SET(RELATIVE_SOURCE_DIR Contents)
  SET(EXECUTABLE_NAME ${BUNDLE_NAME})
ELSEIF(OS_LINUX)
  SET(LIB_INSTALL_DESTINATION lib)
  SET(TARGET_INSTALL_DESTINATION bin)
  SET(SHARE_INSTALL_DESTINATION share)
  SET(RELATIVE_SOURCE_DIR ..)
  SET(EXECUTABLE_NAME ${PROJECT_NAME})
ELSEIF(OS_FREEBSD)
  SET(LIB_INSTALL_DESTINATION lib)
  SET(TARGET_INSTALL_DESTINATION bin)
  SET(SHARE_INSTALL_DESTINATION share)
  SET(RELATIVE_SOURCE_DIR ..)
  SET(EXECUTABLE_NAME ${PROJECT_NAME})
ELSEIF(OS_ANDROID)
  SET(LIB_INSTALL_DESTINATION libs/${ANDROID_NDK_ABI_NAME})
  SET(TARGET_INSTALL_DESTINATION libs/${ANDROID_NDK_ABI_NAME}) #libs/armeabi-v7a
  SET(SHARE_INSTALL_DESTINATION libs/${ANDROID_NDK_ABI_NAME/share)
  SET(RELATIVE_SOURCE_DIR .)
ENDIF(OS_WINDOWS)

ADD_DEFINITIONS(-DRELATIVE_SOURCE_DIR="${RELATIVE_SOURCE_DIR}")

# project sources
SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON)

IF(LOG_TO_FILE)
  ADD_DEFINITIONS(-DLOG_TO_FILE)
ENDIF(LOG_TO_FILE)

ADD_DEFINITIONS(
  -DPROJECT_SUMMARY="${PROJECT_SUMMARY}"
  -DPROJECT_DESCRIPTION="${PROJECT_DESCRIPTION}"
  -DPROJECT_GITHUB_FORK="${PROJECT_GITHUB_FORK}"
  -DPROJECT_GITHUB_ISSUES="${PROJECT_GITHUB_ISSUES}"
  -DPROJECT_DOWNLOAD_LINK="${PROJECT_DOWNLOAD_LINK}"
)

SET(PROJECT_VERSION_HUMAN "${PROJECT_VERSION} ${PROJECT_BUILD_TYPE_VERSION} Revision: ${PROJECT_VERSION_GIT}")
ADD_DEFINITIONS(-DPROJECT_VERSION_HUMAN="${PROJECT_VERSION_HUMAN}")

ADD_SUBDIRECTORY(src)

#CPACK
IF(CPACK_SUPPORT)
  SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PROJECT_SUMMARY} ${PROJECT_NAME}")
  SET(CPACK_PACKAGE_DESCRIPTION ${PROJECT_DESCRIPTION})
  # CPACK_DEBIAN_PACKAGE_DESCRIPTION CPACK_RPM_PACKAGE_SUMMARY
  SET(CPACK_PACKAGE_DESCRIPTION_FILE "${PROJECT_BRANDING_FOLDER}/COPYRIGHT")#CPACK_RPM_PACKAGE_DESCRIPTION
  SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")
  SET(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.md")
  SET(CPACK_RESOURCE_FILE_WELCOME "${CMAKE_SOURCE_DIR}/README.md")

  SET(CPACK_PACKAGE_VENDOR "${PROJECT_COMPANYNAME}")#CPACK_RPM_PACKAGE_VENDOR
  SET(CPACK_PACKAGE_CONTACT "${PROJECT_MAINTAINER_NAME} <${PROJECT_MAINTAINER_MAIL}>")#CPACK_DEBIAN_PACKAGE_MAINTAINER
    
  SET(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
  SET(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
  SET(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_SHORT})

  IF(NOT PROJECT_BUILD_TYPE_VERSION STREQUAL "release")
    SET(CPACK_PACKAGE_VERSION_PATCH "${CPACK_PACKAGE_VERSION_PATCH}-${PROJECT_BUILD_TYPE_VERSION}${PROJECT_VERSION_TWEAK}")
  ENDIF(NOT PROJECT_BUILD_TYPE_VERSION STREQUAL "release")

  SET(CPACK_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION_PATCH})#CPACK_DEBIAN_PACKAGE_VERSION CPACK_RPM_PACKAGE_VERSION
  SET(CPACK_PACKAGE_NAME ${PROJECT_NAME_LOWERCASE})#CPACK_DEBIAN_PACKAGE_NAME CPACK_RPM_PACKAGE_NAME
  SET(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${PLATFORM_ARCH_FULL_NAME}-${PROJECT_VERSION_GIT}")#out package name
  SET(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}")
  SET(CPACK_PACKAGE_INSTALL_DIRECTORY ${PROJECT_NAME})
  SET(CPACK_PACKAGE_EXECUTABLES "${PROJECT_NAME_TITLE};${PROJECT_NAME}")
  MESSAGE(STATUS "CPACK_PACKAGE_FILE_NAME: ${CPACK_PACKAGE_FILE_NAME}")
  SET(CPACK_MONOLITHIC_INSTALL ON)

  IF(OS_WINDOWS)
    #NSIS
    IF(PLATFORM_X86_64)
      SET(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES64")
    ELSE()
      SET(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES")
    ENDIF(PLATFORM_X86_64)
    # There is a bug in NSI that does not handle full unix paths properly. Make
    # sure there is at least one set of four (4) backslashes.
    # SET(CPACK_NSIS_MODIFY_PATH ON)
    SET(CPACK_PACKAGE_ICON "${PROJECT_BRANDING_FOLDER}/windows\\\\nsis-top-logo.bmp")
    SET(CPACK_NSIS_INSTALLED_ICON_NAME "\\\\${PROJECT_NAME}.exe")
    SET(CPACK_CREATE_DESKTOP_LINKS "${PROJECT_NAME}.exe")
    SET(CPACK_NSIS_CREATE_ICONS "CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\${PROJECT_NAME}.lnk\\\" \\\"$INSTDIR\\\\${PROJECT_NAME}.exe\\\"")
    SET(CPACK_NSIS_CREATE_ICONS_EXTRA "CreateShortCut  \\\"$DESKTOP\\\\${PROJECT_NAME}.lnk\\\" \\\"$INSTDIR\\\\${PROJECT_NAME}.exe\\\"")
    SET(CPACK_NSIS_DELETE_ICONS_EXTRA "Delete           \\\"$DESKTOP\\\\${PROJECT_NAME}.lnk\\\"")
    SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}")
    SET(CPACK_NSIS_HELP_LINK "${PROJECT_COMPANYNAME_DOMAIN}")
    SET(CPACK_NSIS_URL_INFO_ABOUT "${PROJECT_DOMAIN}")
    SET(SIDEBAR_IMAGE ${PROJECT_BRANDING_FOLDER}/windows\\\\database.bmp)
    SET(CPACK_NSIS_INSTALLER_MUI_ICON_CODE "!define MUI_WELCOMEFINISHPAGE_BITMAP \\\"${SIDEBAR_IMAGE}\\\"")
    SET(CPACK_NSIS_CONTACT "me@my-personal-home-page.com")
    SET(CPACK_NSIS_MUI_FINISHPAGE_RUN "..\\\\${PROJECT_NAME}.exe")
  ELSEIF(OS_MACOSX)
    # SET(CPACK_OSX_PACKAGE_VERSION "10.5")
  ELSEIF(OS_LINUX)
    SET(CPACK_STRIP_FILES ON)
    #SET(UBUNTU_LP_BUG 300472)
    #SET(CPACK_STRIP_FILES "bin/${PROJECT_NAME}")
    #SET(CPACK_SOURCE_STRIP_FILES "")

    SET(CPACK_PACKAGING_INSTALL_PREFIX "/opt/${PROJECT_NAME_LOWERCASE}")
    
    SET(FIXED_SCRIPT_DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}")

    SET(POST_INSTALL_SCRIPT_GENERATED_PATH "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/scripts/postinst")
    SET(POST_INSTALL_SCRIPT_GENERATED_FIXED_PATH ${FIXED_SCRIPT_DESTINATION}/postinst)
    CONFIGURE_FILE("${PROJECT_BRANDING_FOLDER}/linux/postinst.in" ${POST_INSTALL_SCRIPT_GENERATED_PATH} @ONLY IMMEDIATE)
    FILE(COPY ${POST_INSTALL_SCRIPT_GENERATED_PATH} DESTINATION ${FIXED_SCRIPT_DESTINATION}
      FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)

    SET(PRE_UNINSTALL_SCRIPT_GENERATED_PATH "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/scripts/prerm")
    SET(PRE_UNINSTALL_SCRIPT_GENERATED_FIXED_PATH ${FIXED_SCRIPT_DESTINATION}/prerm)
    CONFIGURE_FILE("${PROJECT_BRANDING_FOLDER}/linux/prerm.in" ${PRE_UNINSTALL_SCRIPT_GENERATED_PATH} @ONLY IMMEDIATE)
    FILE(COPY ${PRE_UNINSTALL_SCRIPT_GENERATED_PATH} DESTINATION ${FIXED_SCRIPT_DESTINATION}
      FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)

    #RPM
    # CPACK_RPM_PACKAGE_ARCHITECTURE CPACK_RPM_PACKAGE_LICENSE CPACK_RPM_PACKAGE_DESCRIPTION CPACK_RPM_SPEC_INSTALL_POST
    # SET(CPACK_PACKAGE_RELEASE 1)
    SET(CPACK_RPM_PACKAGE_LICENSE "GPL v3")
    SET(CPACK_RPM_PACKAGE_AUTOREQPROV "no")
    SET(CPACK_RPM_PACKAGE_REQUIRES "libstdc++, xorg-x11-xinit")
    SET(CPACK_RPM_PACKAGE_RELEASE 1)
    SET(CPACK_RPM_PACKAGE_GROUP "Development/video")
    SET(CPACK_RPM_PACKAGE_ARCHITECTURE ${PLATFORM_PACKAGE_ARCH_NAME})
    SET(CPACK_RPM_PACKAGE_VERSION ${PROJECT_VERSION_SHORT})
    SET(CPACK_RPM_POST_INSTALL_SCRIPT_FILE ${POST_INSTALL_SCRIPT_GENERATED_FIXED_PATH})
    SET(CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE ${PRE_UNINSTALL_SCRIPT_GENERATED_FIXED_PATH})
    SET(CPACK_RPM_CHANGELOG_FILE ${PROJECT_CHANGELOG_FILE})
    #DEB
    # SET(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
    # CPACK_DEBIAN_PACKAGE_HOMEPAGE The URL of the web site for this package
    # SET(CPACK_DEBIAN_PACKAGE_DEBUG ON)
    # libva-drm1 (>= 1.1.0), libva-x11-1 (>= 1.0.3), libvdpau1 (>= 0.2), xinit
    SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.11), libstdc++6 (>= 4.8.2)")
    SET(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
    SET(CPACK_DEBIAN_PACKAGE_SECTION "video")  #input our section
    SET(CPACK_DEBIAN_PACKAGE_RECOMMENDS "Unknown")
    SET(CPACK_DEBIAN_PACKAGE_SUGGESTS "Unknown")
    SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE ${PLATFORM_PACKAGE_ARCH_NAME})#i386
    SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${POST_INSTALL_SCRIPT_GENERATED_FIXED_PATH};${PRE_UNINSTALL_SCRIPT_GENERATED_FIXED_PATH}")
  ELSEIF(OS_ANDROID)
  ENDIF(OS_WINDOWS)
  INCLUDE(CPack)
ENDIF(CPACK_SUPPORT)

#DOCS
IF(DEVELOPER_GENERATE_DOCS)
  CREATE_DOCS(${PROJECT_NAME_LOWERCASE} ${CMAKE_SOURCE_DIR}/docs/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
ENDIF(DEVELOPER_GENERATE_DOCS)

IF(NOT EXISTS ${CMAKE_SOURCE_DIR}/.git/hooks/pre-commit)
  EXECUTE_PROCESS(COMMAND ${CMAKE_SOURCE_DIR}/scripts/create_pre_commit_hook.sh)
ENDIF(NOT EXISTS ${CMAKE_SOURCE_DIR}/.git/hooks/pre-commit)
